package com.static_step.super_intelligent_assistant.controller;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@RestController
public class ChatController {

    @Autowired
    private ChatClient  chatClient;

    /**
     * ChatClient 简单调用
     */
    @GetMapping(value = "/chat/answer", produces = "text/html;charset=utf-8")
    public Flux<String> simpleChat(String message) {

        return chatClient.prompt().user(message).stream().content();
    }
}
